/**
 * 树结构转换
 */
export function transTreeData(tree, data) {
  if (data.length < 0) {
    return []
  }
  for (const item of data) {
    const model = Object.assign({
      label: item.name
    }, item)
    if (item.children && item.children.length > 0) {
      model.children = []
      const children = item.children
      model.children = transTreeData([], children)
    } else {
      delete model.children
    }
    tree.push(model)
  }
  return tree
}
